/*
 *         Copyright (c) KUBOTA Corporation and HUDSON SOFT,
 *                  1994, 1995 All Rights Reserved
 *
 *  This software comprises unpublished confidential information of
 *  KUBOTA Corp. and HUDSON SOFT. It may not be used, copied or made 
 *  available to anyone, except in accordance with the license under
 *  which it is furnished.
 */
static char SccsId[] = "@(#)ctest.c	1.6	9/19/95";
#include <farl.h>
#include <agl.h>
#define TOTAL_ROTATE 7200
#define ROTATE_ANGLE 20
#define TRANS_START 0xff80
#define TRANS_END 0x80
#define TRANS_STEP 0x1

int	cube[] = {
#include "cubestp.h"
};

object		o;
Material	mt;

void
main()
{
     register short	i;
     register short	zoom;

     FX73init();
     FX73_cmap_i6c3();
     AGLInit();
     
     FarlSetPEICMaskReg(FARL_ICMASK_I6C3);
     FarlSetTEControlReg(FARL_TE_LTEN|FARL_TE_ICM|FARL_TE_SPEN|FARL_TE_BCE);
     FarlValidateSwap();
     
     mt.ambient  = 0x4000;
     mt.diffuse  = 0x2000;
     mt.specular = 0x2000;
     
     AGLSetMaterial(&mt, 1);
     
     o.geometryTop    = cube;
     o.geometryLength = sizeof(cube)/sizeof(int);
     o.material       = &mt;
     
     AGLResetObj(&o);
     AGLScaleObj(&o, 0x60, 0x60, 0x60);
     AGLTranslateObj(&o, 0x0, 0x0, 0xffc0);
     
     /* カメラのＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraY(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＸＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraX(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＸＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraX(i%3600);
	  AGLRotateCameraZ(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＹＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraZ(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＹＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＺＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＺＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＸＹＺ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraX(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraZ(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＹＸＺ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLRotateCameraZ(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＸＺＹ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraX(i%3600);
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＹＺＸ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＺＸＹ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのＺＹＸ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラの移動＋ＺＹＸ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLTranslateCamera(0x20, 0x30, 0x40);
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* ＺＹＸ軸回転＋カメラの移動 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLTranslateCamera(0x20, 0x30, 0x40);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのズーム＋ＺＹＸ軸回転 */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLZoomCamera(0x100, 0x100, 0x100);
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* ＺＹＸ軸回転＋カメラのズーム */
     for (i = 0; i <=TOTAL_ROTATE; i+= ROTATE_ANGLE) {
	  AGLResetCamera();
	  AGLRotateCameraZ(i%3600);
	  AGLRotateCameraY(i%3600);
	  AGLRotateCameraX(i%3600);
	  AGLZoomCamera(0x100, 0x100, 0x100);
	  AGLPerspectiveCamera(0xffc0);

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラの移動＋カメラのズーム */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラのズーム＋カメラの移動 */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラの移動＋カメラのズーム＋ＸＹＺ回転 */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLRotateCameraX((i*20)%3600);
	  AGLRotateCameraY((i*20)%3600);
	  AGLRotateCameraZ((i*20)%3600);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* カメラの移動＋ＸＹＺ回転+ Zoom Camera */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLRotateCameraX((i*20)%3600);
	  AGLRotateCameraY((i*20)%3600);
	  AGLRotateCameraZ((i*20)%3600);
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* Zoom Camera + カメラの移動＋ＸＹＺ回転 */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLRotateCameraX((i*20)%3600);
	  AGLRotateCameraY((i*20)%3600);
	  AGLRotateCameraZ((i*20)%3600);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* Zoom Camera + ＸＹＺ回転 + Camera Translate */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLRotateCameraX((i*20)%3600);
	  AGLRotateCameraY((i*20)%3600);
	  AGLRotateCameraZ((i*20)%3600);
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* ＸＹＺ回転 + Zoom Camera + Camera Translate */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLRotateCameraX((i*20)%3600);
	  AGLRotateCameraY((i*20)%3600);
	  AGLRotateCameraZ((i*20)%3600);
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     /* ＸＹＺ回転 + Camera Translate + Camera Zoom */
     zoom = 0x40;
     for (i = 0; i <= (short)(TRANS_END - TRANS_START); i += TRANS_STEP) {
	  AGLResetCamera();
	  AGLRotateCameraX((i*20)%3600);
	  AGLRotateCameraY((i*20)%3600);
	  AGLRotateCameraZ((i*20)%3600);
	  AGLTranslateCamera(TRANS_START + i, TRANS_START + i, 0x20);
	  AGLZoomCamera(zoom, zoom, zoom);
	  AGLPerspectiveCamera(0xffc0);
	  zoom += 0x2;

	  AGLFixPutObj(&o);
	  AGLShot();
     }
     
     return;
}
